//---------------------------------------------------------------------------

#ifndef h_criticalH
#define h_criticalH
//---------------------------------------------------------------------------
struct HCriticalNode
{
   UTF8String Name;
   int Time;
   set<UTF8String> SuccJobSet;

   int MaxTime;
   UTF8String MaxNode;
   int SuccJobIdx;
   bool CompletedFlag;
   bool ExcludeFlag;
   vector<UTF8String> SuccJobVec;

   __fastcall HCriticalNode()
      : Time(0), MaxTime(0), SuccJobIdx(0), CompletedFlag(false), ExcludeFlag(false)
   {}
};

class HCritical
{
public :
   __fastcall HCritical(map<UTF8String, HJobListInfo> &JobMap)
      : Graph(JobMap)
   {}

   void __fastcall Calculate(vector<HJobListInfo*> &Result,
      set<UTF8String> &ExcludeSet);

private :
   void __fastcall InitGraph(set<UTF8String> &ExcludeSet);
   void __fastcall AddLink(const UTF8String &From, const UTF8String &To);
   void __fastcall CalcPath();

   map<UTF8String, HJobListInfo> &Graph;
   map<UTF8String, HCriticalNode> CriticalGraph;
};

#endif
